#include "Anx_RTOS.h"


/* Private includes ----------------------------------------------------------*/
#include "tim.h"

/* Private define ------------------------------------------------------------*/
#define RTOS_RunTimer htim17


/* Private typedef ------------------------------------------------------------*/

/* Extern variables ---------------------------------------------------------*/
unsigned long FreeRTOS_RunTimeTicks = 0;


/* Private variables ---------------------------------------------------------*/
// static const char TAG[] = "SPWM";

/* Public variables ---------------------------------------------------------*/

/* Private callback ---------------------------------------------------------*/

/* Public functions ---------------------------------------------------------*/
void RunTimer_Callback(TIM_HandleTypeDef* htim)
{
    if (htim->Instance == RTOS_RunTimer.Instance)
    {
        FreeRTOS_RunTimeTicks++;
    }
}

void configureTimerForRunTimeStats(void)
{
#ifdef RTOS_RunTimer
    HAL_TIM_Base_Start_IT(&RTOS_RunTimer);
#endif
    FreeRTOS_RunTimeTicks = 0;
}

unsigned long getRunTimeCounterValue(void)
{
    return FreeRTOS_RunTimeTicks;
}